<template>
	<view class="content">

		<view class="item-view" v-for="(item,index) in listComment" :key="index" @click="intoMovie(index)">

			<view class="item-left">
				<text class="item-contenttext">{{item.content}}</text>
				<text class="item-datetext">{{item.startTime}}</text>
			</view>

			<view class="item-right">
				<u-image width="100%" height="200rpx" border-radius="8" :src="$mConfig.formatFileUrl(item.cover)" mode="scaleToFill">
				</u-image>
				<text class="title">{{item.movieName}}</text>
			</view>

		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				listComment: []
			}
		},
		onLoad() {
			this.requestData()
		},
		onPullDownRefresh() {
			this.requestData()
		},
		methods: {
			requestData() {
				//获取自己所有的评论列表
				this.$u.get('/client/comments/mycomments', {}).then(res => {
					this.listComment = res.list;
					uni.stopPullDownRefresh();
				});

			},intoMovie(index){
				uni.navigateTo({
					url: "../movieinfo/movieinfo?movieId="+this.listComment[index].movieId
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: $uni-bg-color-grey;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-bottom: 25rpx;
	}

	.item-view {
		display: flex;
		flex-direction: row;
		padding: 25rpx;
		justify-content: space-between;
		width: 94%;
		background-color: $uni-bg-color;
		border-radius: 12rpx;
		margin-top: 20rpx;

		.item-left {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			width: 73%;

			.item-contenttext {
				font-size: 14px;
				color: $uni-text-color;
				padding-bottom: 15rpx;
				margin-right: 15rpx;
			}

			.item-datetext {
				width: 100%;
				text-align: right;
				font-size: 12px;
				border-top: #eeeeee solid 1rpx;
				padding-top: 10rpx;
				padding-right: 20rpx;
				color: $uni-text-color-grey;
			}
		}

		.item-right {
			width: 27%;
			display: flex;
			padding-left: 20rpx;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			border-left: #eeeeee solid 1rpx;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;

			.title {
				margin-top: 10rpx;
				width: 100%;
				font-size: 14px;
				color: $uni-text-color;
				margin-left: 10rpx;
				margin-right: 10rpx;
			}
		}

	}
</style>
